<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" type="text/css" href="__CSS__/main.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/common.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/bootstrap.min.css" />
    <!-- <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/H-ui.admin.css" />-->
    <![endif]-->
    <title>央行征信查询</title>
</head>
<body>
<div class="contant">
<div class="row">
        <div class="content addapply">
            <div class="fl">
                <div class="box all-box">
                    <h1>客户信息<span>(标*为必填项)</span></h1>
                    <div class="list-block">
                        <div class="sr-only">
                            <input id="report-id" type="hidden" value={$info.report_id}>
                            <input id="user-id" type="hidden" name="userid" value={$info.id}>
                            <input id="apply-id" type="hidden" name="applyId" value={$info.entry_no}>
                            <input id="mate-name" type="hidden" name="" value={$info.spouse_name}>
                            <input id="mate-idty" type="hidden" name="" value={$info.spouse_identity_no}>
                            <input id="mate-mobile" type="hidden" name="" >
                            <input id="company" type="hidden" name="" >
                            <input id="address" type="hidden" name="" >
                            <input type="hidden" id="score" name="score" value=''>
                            <input id="first-commit-time" type="hidden" name="" value={$info.create_time}>
                            <!-- <input id="contact1-name" type="hidden" >
                            <input id="contact1-mobile" type="hidden" >
                            <input id="contact1-relationship" type="hidden" >
                            <input id="contact2-name" type="hidden" >
                            <input id="contact2-mobile" type="hidden" >
                            <input id="contact2-relationship" type="hidden" > -->
                            <foreach name="contactors" item="contactor" >
                                <input type="hidden" id=contactor{$key+1}name value={$contactor.user_name}>
                                <input type="hidden" id=contactor{$key+1}mobile value={$contactor.telephone}>
                                <input type="hidden" id=contactor{$key+1}relationship value={$contactor.relationship}>
                            </foreach>
                        </div>
                        <div class="row">
                            <input id="telephone" type="hidden" value={$info.telephone}>
                            <label>姓名: <i class="required">*</i></label>
                            <input id="user-name" disabled type="text" name="" value={$info.user_name}>
                            <label>身份证号: <i class="required">*</i></label>
                            <input id="identy-no" disabled style="width: 160px;" type="text" name="" value={$info.identity_no}>
                            <label>贷款银行: <i class="required">*</i></label>
                            <input disabled style="width: 180px;" type="text" name="" value={$info.bank_name}>
                            <label>手机号: <i class="required">*</i></label>
                            <input disabled style="width: 180px;" type="text" name="" value={$info.telephone}>
                        </div>
                        <div class="row">
                            <label>上传照片: <i class="required">*</i></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$info.identity_photo_pros}" class="preview" rel="{$info.identity_photo_pros}"><img class="pic" src="{$info.identity_photo_pros}" ><i>身份证正面</i></a></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$info.identity_photo_cons}" class="preview" rel="{$info.identity_photo_cons}"><img class="pic" src="{$info.identity_photo_cons}" ><i>身份证反面</i></a></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$info.credit_authorize_photo}" class="preview" rel="{$info.credit_authorize_photo}"><img class="pic" src="{$info.credit_authorize_photo}" ><i>征信授权书</i></a></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$info.credit_authorize_up}" class="preview" rel="{$info.credit_authorize_up}"><img class="pic" src="{$info.credit_authorize_up}" ><i>征信授权书抬头</i></a></label>
                            <!-- <label class="inputfile" for=""><a target="_blank" href="{$info.credit_authorize_down}" class="preview" rel="{$info.credit_authorize_down}"><img class="pic" src="{$info.credit_authorize_down}" ><i>征信授权书低头</i></a></label> -->
                            <label class="inputfile" for=""><a target="_blank" href="{$info.table_credit_photo}" class="preview" rel="{$info.table_credit_photo}"><img class="pic" src="<?php echo empty($info['table_credit_photo'])?'__PUBLIC__/Common/images/default_upload.png':$info['table_credit_photo']?>" ><i>征信表格照片</i></a></label>
                        </div>
                        <div class="row {$info['spouse_name']?'':'sr-only'}">
                            <label>配偶姓名: <i class="required">*</i></label>
                            <input disabled type="text" name="" value={$info.spouse_name}>
                            <label>身份证号: <i class="required">*</i></label>
                            <input disabled style="width: 160px;" type="text" name="" value={$info.spouse_identity_no}>
                            <label>配偶手机号: <i class="required">*</i></label>
                            <input disabled style="width: 160px;" type="text" name="" value={$info.spouse_telephone}>
                        </div>
                        <div class="row {$info['spouse_name']?'':'sr-only'}">
                            <label>上传照片: <i class="required">*</i></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$info.spouse_id_photo_pros}" class="preview" rel="{$info.spouse_id_photo_pros}"><img class="pic" src="{$info.spouse_id_photo_pros}" ><i>身份证正面</i></a></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$info.spouse_id_photo_cons}" class="preview" rel="{$info.spouse_id_photo_cons}"><img class="pic" src="{$info.spouse_id_photo_cons}" ><i>身份证反面</i></a></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$info.spouse_credit_photo}" class="preview" rel="{$info.spouse_credit_photo}"><img class="pic" src="{$info.spouse_credit_photo}" ><i>征信授权书</i></a></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$info.spouse_credit_up}" class="preview" rel="{$info.spouse_credit_up}"><img class="pic" src="{$info.spouse_credit_up}" ><i>征信授权书抬头</i></a></label>
                            <!-- <label class="inputfile" for=""><a target="_blank" href="{$info.spouse_credit_down}" class="preview" rel="{$info.spouse_credit_down}"><img class="pic" src="{$info.spouse_credit_down}" ><i>征信授权书低头</i></a></label> -->
                        </div>
                        <volist name="assure" id="assure_data">
                        <div class="row">
                            <label>担保姓名: <i class="required">*</i></label>
                            <input disabled type="text" name="" value={$assure_data.user_name}>
                            <label>身份证号: <i class="required">*</i></label>
                            <input disabled style="width: 160px;" name="" value={$assure_data.identity_no}>
                        </div>
                        <div class="row">
                            <label>上传照片: <i class="required">*</i></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$assure_data.assure_id_photo_pros}" class="preview" rel="{$assure_data.assume_credit_photo}"><img class="pic" src="{$assure_data.assure_id_photo_pros}" ><i>身份证正面</i></a></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$assure_data.assure_id_photo_cons}" class="preview" rel="{$assure_data.assure_id_photo_pros}"><img class="pic" src="{$assure_data.assure_id_photo_cons}" ><i>身份证反面</i></a></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$assure_data.assume_credit_photo}" class="preview" rel="{$assure_data.assure_id_photo_cons}"><img class="pic" src="{$assure_data.assume_credit_photo}" ><i>提交征信授权书</i></a></label>
                            <label class="inputfile" for=""><a target="_blank" href="{$assure_data.credit_up_photo}" class="preview" rel="{$assure_data.credit_up_photo}"><img class="pic" src="{$assure_data.credit_up_photo}" ><i>征信授权书抬头照</i></a></label>
                            <!-- <label class="inputfile" for=""><a target="_blank" href="{$assure_data.credit_down_photo}" class="preview" rel="{$assure_data.credit_down_photo}"><img class="pic" src="{$assure_data.credit_down_photo}" ><i>征信授权书低头照</i></a></label> -->
                        </div>
                        </volist>
                    </div>
                </div>
            </div>
            <div class="fr">
            <form id="applyForm" method="post">
                <div class="box all-box">
                    <h1>信用记录</h1>
                    <div class="list-block">
                        <div class="row">
                            <label>借款人信息:<i class="required">*</i></label>
                            <input id="apply-status" type="hidden" name="check_status" value={$info.check_status}>
                            <input type="hidden" name="user_id" value={$info.id}>
                            <textarea name="master_info" id="" cols="38" rows="5">{$info.master_info}</textarea>
                        </div>

                        <div class="row {$info['spouse_name']?'':'sr-only'}">
                            <label>配偶人信息:<i class="required">*</i></label>
                            <textarea name="spouse_info" cols="38" rows="5">{$info.spouse_info}</textarea>
                        </div>

                        <volist  name="assure" id="assure_info" >
                            <div class="row">
                                <label>担保人信息:<i class="required">*</i></label>
                                <input type="hidden" value="{$assure_info.id}" name="aids[]">
                                <textarea name="assure_{$assure_info.id}" id="" cols="38" rows="5">{$assure_info.assure_info}</textarea>
                            </div>
                        </volist>

                            <div class="row ">
                                <label>负面信息:<i class="required">*</i></label>
                                <textarea class="bank_credit_info" name="negative_info" id="user-negative-info"  cols="38" rows="5" >{$info.negative_info}</textarea>
                                <span class="bank_credit_span" style="float: right">
                                    <input id="negative-check" type="button" class="btn btn-warning" value="负面查询" data-toggle="modal" data-target="#negative">
                                </span>
                            </div>

                            <div class="row {$info['spouse_name']?'':'sr-only'}">
                                <label>配偶负面信息:<i class="required">*</i></label>
                                <textarea class="bank_credit_info" name="spouse_negative_info" id='spouse_negative_info' cols="38" rows="5">{$info.spouse_negative_info}</textarea>
                                <span class="bank_credit_span" style="float: right">
                                <input class="spouse-negative btn btn-warning" data={$info.id} type="button" value="负面查询" data-toggle="modal">
                                </span>
                            </div>

                        <volist  name="assure" id="assure_info" >
                            <div class="row">
                                <label>担保人{$key+1}负面信息:<i class="required">*</i></label>

                                <textarea class="bank_credit_info" name="assure_nagative_{$assure_info.id}" cols="38"
                                          rows="5">{$assure_info.assure_info}</textarea>
                                <span class="bank_credit_span" style="float: right">
                                <input class="assure-negative btn btn-warning" data={$assure_info.id} type="button" value="负面查询" data-toggle="modal">
                                </span>
                                <span class="bank_credit_span" style="float: right">
                                <input class="assure-td btn btn-danger" data={$assure_info.id} type="button" value="同盾查询" data-toggle="modal" data-target="#tongdun">
                                </span>
                            </div>
                        </volist>
                    </div>
                    <div class="list-block">
                        <input id="apply-adopt" type="button" class="btn btn-success" value="通过" name="">
                        <input id="reject"  type="button" class="btn btn-warning" value="驳回" name=""  data-toggle="modal" data-target="#wait_model">
                        <input id="apply-del" type="button" class="btn btn-danger" value="拒贷" name="">
                        <input id="tongdun-check" type="button" class="btn btn-warning" value="同盾查询" data-toggle="modal" data-target="#tongdun">
                        <a  href="__URL__/downloadPic?userid={$info.id}" id="downloadPic" type="button" class="btn btn-warning" target="__blank">下载图片</a>
                        <if condition="!empty($info['spouse_name']) AND !empty($info['spouse_telephone']) AND !empty($info['spouse_identity_no'])">
                            <input id="spouse-tongdun-check" type="button" class="btn btn-success" value="配偶同盾查询" data-toggle="modal" data-target="#spouse-tongdun">
                            <a  href="__URL__/downloadSpousePic?userid={$info.id}" id="downloadPic" type="button" class="btn btn-warning" target="__blank">配偶图片</a>
                            <else />
                        </if>
                        <if condition="!empty($assure)">
                            <a  href="__URL__/downloadAssurePic?userid={$info.id}" id="downloadPic" type="button" class="btn btn-warning" target="__blank">担保人图片</a>
                            <else />
                        </if>

                        <!--<a href="{:U('creditPhotoDown?user_type=1&nUserId='.$info['id'])}" class="btn btn-primary" >{$info.user_name}</a>//导出word-->

                        <!--<span class="{$info['spouse_name']?'':'sr-only'}">-->
                        <!--<a href="{:U('creditPhotoDown?user_type=2&nUserId='.$info['id'])}" class="btn btn-primary" >{$info.spouse_name}</a>-->
                        <!--</span>-->

                        <!--<volist  name="assure" id="assure_info" >-->
                        <!--<a href="{:U('creditPhotoDown?user_type=3&assureId='.$assure_info['id'])}" class="btn btn-primary" >{$assure_info.user_name}</a>-->
                        <!--</volist>-->

                    </div>
                </div>
                </form>

            </div>
        </div>
    </div>

    <div class="modal fade" id="tongdun" tabindex="-1" role="dialog" aria-labelledby="tongdunLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="tongdunLabel">贷前审核报告</h4>
                </div>
                <div class="modal-body">
                    <div id="final_score"></div>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="spouse-tongdun" tabindex="-1" role="dialog" aria-labelledby="spouse-tongdunLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="spouse-tongdunLabel">配偶贷前审核报告</h4>
                </div>
                <div class="modal-body">
                    <div id="spouse_final_score"></div>
                </div>
            </div>
        </div>
    </div>


    <div class="modal fade" id="wait_model" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    驳回原因
                </h4>
            </div>
            <div class="modal-body">
                <input type="text" name="wait_reason" class="form-control">
            </div>
            <div class="modal-footer">
                <button type="button" id="apply-reject" class="btn btn-primary">提交</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</div>
<script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__EXTEND__/js/bootstrap.min.js"></script>

<script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
<!--<script type="text/javascript" src="__EXTEND__/static/h-ui.admin/js/H-ui.admin.js"></script>-->

<style type="text/css">
    i{cursor: pointer;}
    .pic{
        width:138px;
        height:118px;
        border-radius:0% ;
        cursor: pointer;
        background: #fff;
        /*position: absolute;
        */z-index: 1;
    }

    #preview{
        position:absolute;border:1px solid #ccc;
        background:#333;padding:3px;display:none;color:#fff;
        opacity: .9;
    }
</style>

<script type="text/javascript">
    // 配偶
    $('.spouse-negative').click(function(){
        var user_id = $(this).attr('data');

        $.ajax({
            type: "POST",
            url: "__URL__/spouseNegativeCheck",
            data:
            {user_id:user_id},
            success: function(msg)
            {
                obj_data = $.parseJSON(msg);
                console.log(obj_data);
                var target = 'textarea[name="spouse_negative_info"]';
                $(target).html(obj_data.msg);
            }
        });
    });

    // 担保人
    $('.assure-negative').click(function(){
        var assure_id = $(this).attr('data');

        $.ajax({
            type: "POST",
            url: "__URL__/assureNegativeCheck",
            data:
            {assure_id:assure_id},
            success: function(msg)
            {
                obj_data = $.parseJSON(msg);
                console.log(obj_data);
                var target = 'textarea[name="assure_nagative_'+assure_id+'"]';
                $(target).html(obj_data.msg);
            }
        });
    });

    // 主贷人
    $('#negative-check').click(function(){
        var user_id = $('input[name="user_id"]').val();

        $.ajax({
            type: "POST",
            url: "__URL__/negativeCheck",
            data:
            {user_id:user_id},
            success: function(msg)
            {
                obj_data = $.parseJSON(msg);
                console.log(obj_data);
                $('#user-negative-info').html(obj_data.msg);
            }
        });
    });
    // starting the script on page load
    $(document).ready(function(){
        // imagePreview();
    });

    // 审核通过
    $('#apply-adopt').click(function(){
        $('#apply-status').val(-1);
        if (confirm('确认通过吗？')==true){
            $('#applyForm').submit();
        }else{
          return false;
        }
    });

    // 驳回
    $('#apply-reject').click(function(){
        $('#apply-status').val(901);
        if (confirm('确认驳回吗？')==true){
            $('#applyForm').submit();
        }else{
          return false;
        }
    });

    $('#apply-del').click(function(){
        $('#apply-status').val(-6);
        if (confirm('确认拒贷吗？')==true){
            $('#applyForm').submit();
        }else{
          return false;
        }
    });

//    //导出word文档
//    $('#user_word_out').click(word_out(1));
//    function word_out($type){
//        cUserId=$('#user-id').val();
//        $.ajax({
//            type: "POST",
//            url: "__URL__/creditPhotoDown",
//            data: {user_type : $type ,cUserId : cUserId},
//            success: function (msg) {
////                $('#bank_rate').val($.parseJSON( msg).rate);
//                alert (123);
//            }
//        });
//    }

        $('#tongdun-check').click(function(){
            report_id         = $('#report-id').val();
            console.log(report_id);

            $.ajax(
                    {
                        type: "POST",
                        url: "__URL__/preloanReport",
                        data:
                        {
                            report_id:report_id
                        },
                        success: function(msg)
                        {
                            obj_data = $.parseJSON(msg);
                            console.log(obj_data);
                            if (obj_data.success) {
                                report_time = obj_data.report_time;
                                report_time = report_time.toString();

                                switch(obj_data.final_decision){
                                    case 'Accept':
                                        final_decision = '建议通过';
                                        break;
                                    case 'Review':
                                        final_decision = '建议审核';
                                        break;
                                    case 'Reject':
                                        final_decision = '建议拒绝';
                                        break;
                                }

                                showData =
                                        '<div>'+
                                        '风险分数：'+obj_data.final_score+'<br>'+
                                        '风险结果：'+final_decision+'<br>'+
                                        '报告编号：'+obj_data.report_id+'<br>'+
                                        '报告时间：'+getDateTime(report_time.substr(0,10))+'<br>'+
                                        '信用分：'+obj_data.credit_score+'<br>'+
                                        '身份证所属地：'+obj_data.address_detect.id_card_address+'<br>'+
                                        '银行卡所属地：'+obj_data.address_detect.bank_card_address+'<br>'+
                                        '手机所属地：'+obj_data.address_detect.mobile_address+'<br>'+
                                        '</div>';
                                $('#score').val(obj_data.final_score);
                                $('#final_score').empty().append(showData);

                            }else{
                                $('#extra-info').append('<div class="bule">'+obj_data.reason_desc+'</div>');
                            }
                        }
                    });
        });

        // 配偶同盾查询
        $('#spouse-tongdun-check').click(function(){
            cUserId = $('#user-id').val();
            console.log(cUserId);
            $.ajax({
                type: "POST",
                url: "__URL__/preloanApply",
                data:{user_id:cUserId},
                success: function(msg){
                    obj_data = $.parseJSON(msg);
                    console.log(obj_data);
                    if (obj_data.success) {
                        report_time = obj_data.report_time;
                        report_time = report_time.toString();

                        switch(obj_data.final_decision){
                            case 'Accept':
                                final_decision = '建议通过';
                                break;
                            case 'Review':
                                final_decision = '建议审核';
                                break;
                            case 'Reject':
                                final_decision = '建议拒绝';
                                break;
                            }

                            showData ='<div>'+
                                      '风险分数：'+obj_data.final_score+'<br>'+
                                      '风险结果：'+final_decision+'<br>'+
                                      '报告编号：'+obj_data.report_id+'<br>'+
                                      '报告时间：'+getDateTime(report_time.substr(0,10))+'<br>'+
                                      '信用分：'+obj_data.credit_score+'<br>'+
                                      '身份证所属地：'+obj_data.address_detect.id_card_address+'<br>'+
                                      '银行卡所属地：'+obj_data.address_detect.bank_card_address+'<br>'+
                                      '手机所属地：'+obj_data.address_detect.mobile_address+'<br>'+
                                      '</div>';
                                $('#score').val(obj_data.final_score);
                                $('#spouse_final_score').empty().append(showData);

                            }else{
                                $('#extra-info').append('<div class="bule">'+obj_data.reason_desc+'</div>');
                            }
                        }
                    });
        });

        // 担保人同盾查询
        $('.assure-td').click(function(){
            var assure_id = $(this).attr('data');

            $.ajax({
                type: "POST",
                url: "__URL__/assureTd",
                data:
                {assure_id:assure_id},
                success: function(msg)
                {
                    obj_data = $.parseJSON(msg);
                    console.log(obj_data);
                    if (obj_data.success) {
                        report_time = obj_data.report_time;
                        report_time = report_time.toString();

                        switch(obj_data.final_decision){
                            case 'Accept':
                                final_decision = '建议通过';
                                break;
                            case 'Review':
                                final_decision = '建议审核';
                                break;
                            case 'Reject':
                                final_decision = '建议拒绝';
                                break;
                            }

                            showData ='<div>'+
                                      '风险分数：'+obj_data.final_score+'<br>'+
                                      '风险结果：'+final_decision+'<br>'+
                                      '报告编号：'+obj_data.report_id+'<br>'+
                                      '报告时间：'+getDateTime(report_time.substr(0,10))+'<br>'+
                                      '信用分：'+obj_data.credit_score+'<br>'+
                                      '身份证所属地：'+obj_data.address_detect.id_card_address+'<br>'+
                                      '银行卡所属地：'+obj_data.address_detect.bank_card_address+'<br>'+
                                      '手机所属地：'+obj_data.address_detect.mobile_address+'<br>'+
                                      '</div>';
                                $('#final_score').empty().append(showData);

                    }else{
                        $('#extra-info').append('<div class="bule">'+obj_data.reason_desc+'</div>');
                    }
                }
            });
        });

        function getDateTime(unixTime, isFull, timeZone) {
            if (typeof (timeZone) == 'number')
            {
                unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60;
            }
            var time = new Date(unixTime * 1000);
            var ymdhis = "";
            ymdhis += time.getUTCFullYear() + "-";
            ymdhis += (time.getUTCMonth()+1) + "-";
            ymdhis += time.getUTCDate();
            if (isFull === true)
            {
                ymdhis += " " + time.getUTCHours() + ":";
                ymdhis += time.getUTCMinutes() + ":";
                ymdhis += time.getUTCSeconds();
            }
            return ymdhis;
        }
</script>
</body>
</html>
